package collection;

import java.util.ArrayList;
import java.util.Collection;

/**
 * java集合框架
 */
public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection c = new ArrayList();

        c.add("one");
        c.add("123");
        c.add(123);//触发自动装箱
        c.add("qw");
        System.out.println(c);

        int size = c.size();
        System.out.println("size:" + size);

        //boolean isEmpty()
        //判断当前集合是否是空集
        boolean isEmpty = c.isEmpty();//c==null
        System.out.println("是否为空集" + isEmpty);

        c.clear();
        System.out.println("集合已清空");
        System.out.println(c);
        System.out.println("size:" + size);
        System.out.println("是否为空集:" + c.isEmpty());
    }
}
